<!--支付方式选择组件-->
<template>
  <div>
    <a-form :form='payform'>


        <div v-if='showBouns'>
          <a-col :md='12' :sm='24'>
            <a-form-item
              :labelCol='labelCol1'
              :wrapperCol='wrapperCol1'
              label='商品层级'
              >
              <j-tree-select
                v-model='modals.productType'
                placeholder='请选择商品层级'
                ref='productLevelCode'
                data-type='product_type'
                @change='(e,v)=>changeJselect(e,v)'
              />
            </a-form-item>
          </a-col>
          <a-col :md='12' :sm='24'>
            <a-form-item
              :labelCol='labelCol1'
              :wrapperCol='wrapperCol1'
              label='货补商品'
            >
              <j-select-product  placeholder='请选择商品' :queryParams='ptQueryParam'
                                :multiple='false' @select='(row)=>selectRole(row)' />
            </a-form-item>
          </a-col>
        </div>
        <div v-if='points'>
          <a-col :md='12' :sm='24'>
            <a-form-item
              :labelCol='labelCol1'
              :wrapperCol='wrapperCol1'
              label='税点'
              >
              <a-input v-model='modals.moneyPoint'></a-input>
            </a-form-item>
          </a-col>

        </div>

    </a-form>
  </div>
</template>

<script>
import JTreeSelect from '@/components/cn-form/JTreeSelect'
import JSelectProduct from '@/components/cn-select-popup/JSelectProduct'

export default {
  name: 'HpayselectCom',
  components: {
    JTreeSelect,
    JSelectProduct
  },
  data() {
    return {
      modals: {
        payWay: null,
        productType: null
      },
      showBouns: false,
      points: false,
      payform: this.$form.createForm(this),
      labelCol1: {
        xs: {
          span: 24
        }
        ,
        sm: {
          span: 6
        }
      },
      wrapperCol1: {
        xs: {
          span: 24
        }
        ,
        sm: {
          span: 18
        }
      },
      ptQueryParam: {}
    }
  },
  watch: {
    modals: {
      deep: true,
      handler(val) {
        this.totalVlueSend()
      }
    }
  },
  methods: {
    // 提交值
    totalVlueSend() {
      this.$emit('payWayCom', this.modals)
    },
    selectRole(row, name, key) {
      console.log('855')
      this.modals.productCode = row[0].matnr
      this.modals.productName = row[0].maktx
      this.totalVlueSend()

    },
    changeJselect(name, value) {
      console.log(name, value)
      this.modals.typeCode = name
      this.modals.typeName = value
    },
    handleInput(e) {
      this.points = false
      this.showBouns = false
      if (e == 2) {
        this.showBouns = true
      } else if (e == 3) {
        this.points = true
      }
      this.modals.payWay = e
      console.log(this.modals)
    }
  }
}
</script>

<style scoped>

</style>